home *** CD-ROM | disk | FTP | other *** search
- Path: laurel.yorku.ca!ken
- From: ken@yorku.ca (Kenneth Kafieh)
- Newsgroups: comp.lang.c++
- Subject: Re: Faster FILE subroutines in standard C?
- Date: 4 Jan 1996 04:34:05 GMT
- Organization: York University
- Message-ID: <4cflbt$d4h@sunburst.ccs.yorku.ca>
- References: <Pine.A32.3.91.960103111942.52249A-100000-100000-100000-100000-100000@afep.yorku.ca>
- NNTP-Posting-Host: laurel.yorku.ca
- X-Newsreader: TIN [version 1.2 PL2]
-
- Ken (ken@afep.yorku.ca) wrote:
-
- : I found that I was able to get 3-4 time faster performance by using good
- : old ANSI C file accessing routines (like fgets, fseek, ftell, ...etc.)
- : instead of C++ streams (like ifstream::getline, fstream::seekg, ...etc.)
- : I wrote the program originally in C++ (a simple little phonebook for my
- : own use) and it took about 9 seconds to scan a 100Kb file for a 3 byte
- : string!!! Fed up, I rewrote it in C and voila! Now it takes 2 secs!
- : I'm using Borland C++ v2.0.
-
- : Does that sound right? Maybe my code was inefficiently written?
- : I know C++ is generally slower than C but I didn't think that
- : file stuff would be too. What did I do wrong? Am I missing
- : something. Maybe I'll post the code too, later. Has anyone
- : else noticed this too?
-
- : Come to think of it, the coding in
- : C was cleaner looking, too.
-
- : -------------
- : And So Until Next Time...
-
- : I'm Ken
-
-
- --
-
- And So Until Next Time...
-
- I'm Ken
-